# -*- coding: utf-8 -*-
from django.http import HttpResponse

from comum.reports import EtiquetaPessoa
from geraldo.generators import PDFGenerator
from comum.models import Pessoa

def etiqueta_pessoa(request, obj_pk):
    response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=etiqueta.pdf'

    pessoa = Pessoa.objects.filter(pk = obj_pk)
    import pdb; pdb.set_trace()
    
    report = EtiquetaPessoa(queryset=pessoa)
    report.generate_by(PDFGenerator, filename=response)

    return response

def etiquetas_pessoas(request):
    response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=etiquetas.pdf'

    pessoas = Pessoa.objects.order_by('id')
        
    report = EtiquetaPessoa(queryset=pessoas)
    report.generate_by(PDFGenerator, filename=response)

    return response

